package cn.com.dhcc.turbo.entity.registry;

import java.io.Serializable;
import java.util.Date;

import cn.com.dhcc.app.core.annotation.SiColumn;
import cn.com.dhcc.app.core.annotation.SiNotDbColumn;
import cn.com.dhcc.app.core.annotation.SiTable;
import cn.com.dhcc.app.core.base.ModuleFeatureBean;
/**
 * 信息同步表
 * @author qiao
 * @2014-5-15 @上午10:02:06
 */
@SiTable(name="turbo_sync_info")
public class SynchronizeInfo extends ModuleFeatureBean implements Serializable{

	private static final long serialVersionUID = 1L;
	@SiColumn(isId=true)
	private String id;//	N	CHAR(32)	N			
	private String sn;//SN	N	CHAR(32)	N			批次号
	private String fromNode;//FROMNODE	N	CHAR(32)	N			发起节点
	private String toNode;//TONODE	N	CHAR(32)	N			接收节点
	private String srcNode;//维护节点id
	@SiColumn(name="DATA_CONTENT")
	private String dataContent;//DATA_CONTENT	N	CLOB	Y			同步的内容
	private String status;//STATUS	N	CHAR(1)	N			0 同步失败 1发送成功2 待发送 3发送中 
	private Date mtime;//MTIME	N	DATE	Y	sysdate		
	private String remark;//REMARK	N	VARCHAR2(255)	Y	
	@SiColumn(name="DATA_TYPE")
	private String dataType;
	private String isFromParent;
	@SiColumn(name="OPER_TYPE")
	private String operType;//
	@SiNotDbColumn
	private boolean whenErrorRepeat;
	@SiNotDbColumn
	private String syncUrl;
	@SiNotDbColumn
	private String toNodeName;
	@SiNotDbColumn
	private String fromNodeName;
	@SiNotDbColumn
	private String srcNodeName;
	@SiNotDbColumn
	private NodeInfo fromNodeInfo;//从哪来
	@SiNotDbColumn
	private NodeInfo srcNodeInfo;//数据源是谁
	@SiNotDbColumn
	private NodeInfo toNodeInfo;//数据源是谁
	public String getFromNodeName() {
		return fromNodeName;
	}
	public void setFromNodeName(String fromNodeName) {
		this.fromNodeName = fromNodeName;
	}
	/**
	 * 同步数据类型
	 */
	public static enum SyncType{
		NODE_REGIST("1","节点注册之后的一次性同步",false),
		NODE_INFO("2","节点基本信息",true),
		DOMAIN_INFO("3","域基本信息",true),
		/*SYS_INFO("4","系统基本信息",true),*/
		PILE_LINE("5","通道基本信息",true),
		PILE_LINE_LIST("6","多个通道基本信息",false),
		MONITOR("7","监控信息",false),
		CREATE_REL("8","建立交换关系",false),
		FLEX_LAYOUT("9","交换关系地图",false),
		DELEE_REL("10","删除交换关系",false),
		GAP_CONFIG("11","网闸权限信息",true),
		ADAPTER("12","适配器绑定信息",true),
		DATACATEGORY("13","数据分类",true),
		ADAPTER_BASE("14","适配器基本信息",true),
		REL_PIPE_LINE("15","适配器基本信息",false),
		TEST_CONNECT("99","测试信息",false);
		
		
		private String code;
		private String name;
		private boolean reSync;
		SyncType(String code,String name){
			this.code = code;
			this.name = name;
		}
		SyncType(String code,String name,boolean reSync){
			this.code = code;
			this.name = name;
			this.reSync = reSync;
		}
		public String getCode() {
			return code;
		}
		public void setCode(String code) {
			this.code = code;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public boolean isReSync() {
			return reSync;
		}
	}
	public static enum SyncStatus{
		WAIT("2","待同步"),
		ING("3","同步中"),
		SUCCESS("1","同步成功"),
		FAIL("0","同步失败");
		private String code;
		private String name;
		SyncStatus(String code,String name){
			this.code = code;
			this.name = name;
		}
		public String getCode() {
			return code;
		}
		public void setCode(String code) {
			this.code = code;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
		
	}
	public static enum SyncOperType{
		INSERT("1","新增"),
		UPDATE("2","修改"),
		DELETE("3","删除");
		private String code;
		private String name;
		SyncOperType(String code,String name){
			this.code = code;
			this.name = name;
		}
		public String getCode() {
			return code;
		}
		public void setCode(String code) {
			this.code = code;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	public String getFromNode() {
		return fromNode;
	}
	public void setFromNode(String fromNode) {
		this.fromNode = fromNode;
	}
	public String getToNode() {
		return toNode;
	}
	public void setToNode(String toNode) {
		this.toNode = toNode;
	}
	public String getDataContent() {
		return dataContent;
	}
	public void setDataContent(String dataContent) {
		this.dataContent = dataContent;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public Date getMtime() {
		return mtime;
	}
	public void setMtime(Date mtime) {
		this.mtime = mtime;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	public String getDataType() {
		return dataType;
	}
	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
	
	public String getIsFromParent() {
		return isFromParent;
	}
	public void setIsFromParent(String isFromParent) {
		this.isFromParent = isFromParent;
	}
	
	public String getOperType() {
		return operType;
	}
	public void setOperType(String operType) {
		this.operType = operType;
	}
	
	public String getSyncUrl() {
		return syncUrl;
	}
	public void setSyncUrl(String syncUrl) {
		this.syncUrl = syncUrl;
	}
	
	public String getToNodeName() {
		return toNodeName;
	}
	public void setToNodeName(String toNodeName) {
		this.toNodeName = toNodeName;
	}
	
	public NodeInfo getFromNodeInfo() {
		return fromNodeInfo;
	}
	public void setFromNodeInfo(NodeInfo fromNodeInfo) {
		this.fromNodeInfo = fromNodeInfo;
	}
	
	public NodeInfo getSrcNodeInfo() {
		return srcNodeInfo;
	}
	public void setSrcNodeInfo(NodeInfo srcNodeInfo) {
		this.srcNodeInfo = srcNodeInfo;
	}
	
	public NodeInfo getToNodeInfo() {
		return toNodeInfo;
	}
	public void setToNodeInfo(NodeInfo toNodeInfo) {
		this.toNodeInfo = toNodeInfo;
	}
	
	public String getSrcNode() {
		return srcNode;
	}
	public void setSrcNode(String srcNode) {
		this.srcNode = srcNode;
	}
	
	public String getSrcNodeName() {
		return srcNodeName;
	}
	public void setSrcNodeName(String srcNodeName) {
		this.srcNodeName = srcNodeName;
	}
	
	public boolean isWhenErrorRepeat() {
		return whenErrorRepeat;
	}
	public void setWhenErrorRepeat(boolean whenErrorRepeat) {
		this.whenErrorRepeat = whenErrorRepeat;
	}
	@Override
	public String toString() {
		return "SynchronizeInfo [id=" + id + ", sn=" + sn + ", fromNode="
				+ fromNode + ", toNode=" + toNode + ", dataContent="
				+ dataContent + ", status=" + status + ", mtime=" + mtime
				+ ", remark=" + remark + ", dataType=" + dataType
				+ ", isFromParent=" + isFromParent + ", operType=" + operType
				+ ", syncUrl=" + syncUrl + ", toNodeName=" + toNodeName + "]";
	}
	
	
	

}
